package com.zxl.yunpicture.application.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zxl.yunpicture.infrastructure.common.DeleteRequest;
import com.zxl.yunpicture.interfaces.dto.space.SpaceAddRequest;
import com.zxl.yunpicture.interfaces.dto.space.SpaceQueryRequest;
import com.zxl.yunpicture.domain.space.entity.Space;
import com.zxl.yunpicture.domain.user.entity.User;
import com.zxl.yunpicture.interfaces.vo.space.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author ZhangXL
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-02-26 17:52:23
*/
public interface SpaceApplicationService extends IService<Space> {



    /**
     * 获取空间封装（单条）
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);


    /**
     * 获取空间包装类（分页）
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 将查询请求转化为QueryWrapper对象
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);


    /**
     * 根据空间级别自动填充限额数据
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);


    /**
     * 删除空间，关联删除空间中的图片
     * @param deleteRequest
     * @param request
     */
    void deleteSpace(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 添加空间请求
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);


    /**
     * 检查空间权限
     * @param loginUser
     * @param space
     */
    void checkSpaceAuth(User loginUser, Space space);
}
